<script type="text/javascript" src="<?php echo SystemProperties::$app_host_webroot;?>/js/select_date.js"></script>
<script type="text/javascript">
function deleteCoupon(pid, id) {
    if (confirm('确认删除'+id+'?')) {
    	var url = "<?php echo SystemProperties::$app_host;?>"+"/product/deleteCoupon/"+pid+'/'+id;
    	doPost(url,'','callbackformj');	
    }
}
</script>
<div id="callbackformj">
</div>

<table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
<tr>
<td>
<b>优惠码管理后台</b> 
</td>
</tr>
<tr>
<td>
当前产品：<b><?=$info['g_name']?> </b>
</td>
</tr>

<tr>
<td>
<form method="POST" action="<?php echo SystemProperties::$app_host;?>/product/addCoupon/<?=$pid?>">
添加优惠码，请粘贴到下方，注意回车分隔，<b>一行一个</b>，每行不超过255字符：<br />
有效期至：<input name="time" readonly type="text" value="<?=date('Y-m-d')?>" size="15" onFocus="CalendarWebControl.show(this,false,this.value);">  
<br />
<textarea name="list" style="width:400px;height:120px;"></textarea> 
<input type="submit" value="确认添加"></input>
</form>
</td>
</tr>
</table>
<br />

<table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
<tr>
<td width="320">当前产品“<b><?=$info['g_name']?></b>”的优惠码列表</td>
<td>
查看： &nbsp;&nbsp;
<a href="<?php echo SystemProperties::$app_host;?>/product/coupon/<?=$pid?>/0">全部</a>&nbsp;&nbsp;
<a href="<?php echo SystemProperties::$app_host;?>/product/coupon/<?=$pid?>/2/time">最近已发放</a>&nbsp;&nbsp;
<a href="<?php echo SystemProperties::$app_host;?>/product/coupon/<?=$pid?>/1">未发放</a>&nbsp;&nbsp;
</td>
</tr>
</table>
<br />
<table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
<tr>
<th  width="60">ID</th>
<th width="100">领用者</th>
<th width="120">领用时间</th>
<th>代码</th>
<th>有效期</th>
<th>操作</th>
</tr>  
<?php foreach ($list as $li) { 
    $t = $li['g_coupon'];
    ?>
<tr>
<td><?=$t['id']?></td>
<td><?=empty($t['uid'])?'无':'<a href="'.SystemProperties::get_profile_url($t['uid']).'">'.$t['uid'].'</a>'?></td>
<td width="120"><?=$t['time']?></td>
<td><?=$t['code']?></td>
<td><?=date('Y-m-d',strtotime($t['limit_time']))?></td>
<td><a href="javascript:deleteCoupon(<?=$pid?>,<?=$t['id']?>)">删除</a></td>
</tr>
<?php } ?>
</table>
<br />
<table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
<tr>
<td width="120">共 <?=$total?> 条</td>
<td>
<?=$pager?>
</td>
</tr>
</table>


